function timerJetX(time) { $('.jetx-promotion .timer').removeClass('end'); let countDownDate = new Date(time).getTime(); //let x = setInterval(function() { // Get today's date and time let now = new Date().getTime(); // Find the distance between now and the count down date let distance = countDownDate - now; if (distance < 1000 * 60 * 60) $('.jetx-promotion .timer').addClass('end'); // Time calculations for days, hours, minutes and seconds let days = Math.floor(distance / (1000 * 60 * 60 * 24)); let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); let seconds = Math.floor((distance % (1000 * 60)) / 1000); $('.jetx-promotion .days').html(timerItem(days)); $('.jetx-promotion .hours').html(timerItem(hours)); $('.jetx-promotion .minutes').html(timerItem(minutes)); // If the count down is finished, write some text //if (distance < 0) { // clearInterval(x); //} //}, 10000000); } function DrawJetXPromotionPopup(data) { let enableDays = data.EnableDays; for (let i = 0; i < enableDays.length; i++) { if (enableDays[i]) { let $progress = document.querySelectorAll('.promotion-progress')[i]; $($progress).attr('class', 'promotion-progress active'); let $tabs = document.querySelectorAll('.promotion-tab')[i]; $($tabs).attr('class', `promotion-tab tab-day${i + 1} ${i === 0 ? 'active' : ''}`); } else { let $progress = document.querySelectorAll('.promotion-progress')[i]; $($progress).attr('class', 'promotion-progress disabled'); let $tabs = document.querySelectorAll('.promotion-tab')[i]; $($tabs).attr('class', `promotion-tab tab-day${i + 1} disabled`); } } for (let i = 1; i < 4; i++) { $(`.tab-day${i}`).attr('data-dayleftcount', data[`Day${i}SuccessCount`]); } if (!enableDays[1] && data['CashbackDay1'].length > 0) { let $element = $('.promotion-progress')[0]; $($element).removeClass('disabled').addClass('active'); } UpdateJetXPromotionFooterText(1); for (let i = 1; i < enableDays.length + 1; i++) { if (data['CashbackDay' + i] === undefined || data['CashbackDay' + i] === null) return; let html = ReturnJetxPromoutionList(data['CashbackDay' + i], data[`Day${i}SuccessCount`], i); $('.CashbackDay' + i).html(html); } $('.promotion-bet-sum').html(parseFloat(data.BetSum).toFixed(fractionDigit) + ' ' + currencyCode); $('.jetx-promotion').fadeIn(100).addClass(localeCode); $('.rulesText1').html(GetCaption('jetx.promotion.rules.restrictions.budget.one').format(data.GiftType.Bet, currencyCode)); $('.rulesText2').html(GetCaption('jetx.promotion.rules.restrictions.budget.two').format(data.GiftType.Bet * 100000, currencyCode)); } function ReturnJetxPromoutionList(lists, succesCount, index) { const maxListCount = succesCount > 10 ? succesCount : 10; let percent = (100 * succesCount) / maxListCount; progressBar(percent, index); let html = '' for (let i = 0; i < lists.length; i++) { if (lists[i] !== undefined) { html += `
${i + 1}
${parseFloat(lists[i].Bet).toFixed(fractionDigit) + ' ' + currencyCode}
${lists[i].CashoutCoefficient}x
${lists[i].Win > 0 ? parseFloat(lists[i].Win).toFixed(fractionDigit) + ' ' + currencyCode : '-'}
` } else { html += `
${i + 1}
${parseFloat(0).toFixed(fractionDigit)} ${currencyCode}
${parseFloat(0).toFixed(fractionDigit)}x
${parseFloat(0).toFixed(fractionDigit)} ${currencyCode}
`; } } for(let i = 1; i < 4; i++) { $(`tab-day${i}`).attr('data-daycount', ) } return html; } function UpdateJetXPromotionFooterText(level) { let countOfList = 10 - parseFloat($(`.tab-day${level}`).attr('data-dayleftcount')); countOfList = countOfList >= 0 ? countOfList : 0; return $('.footer-text').html(`${GetCaption('jetx.promotion.footer.level.place')} ${countOfList} ${GetCaption('jetx.promotion.footer.complete.level')} ${level}`) } function progressBar(value, index) { let dasharray = false ? 184 : 213; let $element = $('.promotion-progress.active')[index - 1] let percent = (value * dasharray) / 100; $($element).find('.progress').attr("stroke-dasharray", percent + ", 10000"); if (value > 0) $($element).find('.progress-circle').show(); $($element).find('.progress-to-percent').html(parseInt(percent / dasharray * 100) + '%'); } $(document).ready(function (){ $(document).on('click', '.jetx-promotion-close', function () { $('.jetx-promotion').css('display', 'none'); $('#game-container-div').show(); }); $(document).on('click', '.close-jetx-promotion-rules', function () { $('.jetx-promotion-rules').hide(); $('.promotion-wrapper').show(); $('.jetx-timer').insertBefore(('.promotion-header-bottom')); $('.promotion-close-style').addClass('jetx-promotion-close').removeClass('close-jetx-promotion-rules'); }); $(document).on('click', '.promotion-rules-icon', function () { $('.jetx-promotion-rules').show(); $('.promotion-wrapper').hide(); $('.jetx-timer').insertBefore(('.jetx-promotion-rules-content')); $('.promotion-close-style').addClass('close-jetx-promotion-rules').removeClass('jetx-promotion-close'); }); $(document).on('click', '.promotion-tab', function () { let tabIndex = parseFloat($(this).attr('data-page')); $('.promotion-tab').removeClass('active'); $(this).addClass('active'); $('.table-tbody > div').removeClass('active'); $('.CashbackDay' + tabIndex).addClass('active'); UpdateJetXPromotionFooterText(tabIndex); }); })